<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<style type="text/css">
		#box{
			width: 300px;
			height: 200px;
			border: 3px solid black;
			margin: 30px auto;
		}
		#box i{
			float: left;
			display: block;
			padding: 10px;
		}
		#box span{
			float: left;
			display: block;
			padding: 10px;
			border: 1px solid black;
			cursor: pointer;
		}
		#box .color{
			border: 1px solid red;
		}
	</style>
	<script src="../jquery-1.11.3.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('#box span').click(function(){
//				链式写法 让当前点击的那个元素加类 兄弟元素移除类
				$(this).addClass('color').siblings().removeClass('color');
			})
		})
	</script>
</head>
<body>
	<div id="box">
		<i>颜色：</i>
		<span>土豪金</span>
		<span>玫瑰粉</span>
		<span>深空灰</span>
	</div>
</body>
</html>